﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BaseDatos;

namespace SCHD
{
    public partial class WFFormulario_Edit : TDV.Controles.Base.WinForm.BaseForm_Tipo01
    {
        public WFFormulario_Edit()
        {
            InitializeComponent();
        }
        private string Codigo = "";
        private string Nombre = "";
        private string Descripcion = "";
        private string Comando = "";

        public WFFormulario_Edit(string codigo,string nombre,string descripcion, string comando)
            :this()
        {
            this.Codigo = codigo;
            this.Nombre = nombre;
            this.Descripcion = descripcion;
            this.Comando = comando;
        }

        private void BtnAceptar_Click(object sender, EventArgs e)
        {
            string usr = Environment.UserName.ToUpper();
            string wks = Environment.MachineName.ToUpper();
            string SQL = "" +
                            "update chdformularios set nomform = '" + TxtNombre.Text + "',dscform = '" + TxtDescripcion.Text + "',usrmod = '" + Environment.UserName.ToUpper() + "',comando = '" + TxtComando.Text + "',fchmod = sysdate,wksmod ='" + Environment.MachineName.ToUpper() + "' where codform  = '" + TxtCodigo.Text.ToUpper() + "'";
            ConexionBaseDatos.Conexion.EjecutarComando(SQL, CommandType.Text);
            DialogResult = DialogResult.OK;
        }

        private void BtnCancelar_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }

        private void WFFormulario_Edit_Load(object sender, EventArgs e)
        {
            TxtCodigo.Text = Codigo;
            TxtNombre.Text = Nombre;
            TxtDescripcion.Text = Descripcion;
            TxtComando.Text = Comando;
        }
    }
}
